<?php

namespace app\web\command;

use app\common\util\Tools;
use think\console\Input;
use think\console\Output;
use think\facade\Log;

class UploadTest extends CommonTest
{

    //再命令窗口中执行“php think interfaceWeb-UploadTest”
    protected function configure()
    {
        $this->setName('interfaceWeb-UploadTest')
            ->setDescription('接口测试');
    }

    public function execute(Input $input, Output $output)
    {
        parent::execute($input, $output);

        /** 资源上传管理 */

        //Route::any('web/image/delHistory', 'web/upload/softDelete');                                                        // 软删除图片
        $data = Tools::curl($this->url . "web/image/delHistory", json_encode(["token" => "$this->token", "ids" => "3"]));
        Log::write("post". var_export($data,true));
        echo $data . "\n\n";
        echo print_r(json_decode($data,1)) . "\n\n";

        //Route::any('web/image/delete', 'web/upload/delete');                                                                // 删除图片
        $data = Tools::curl($this->url . "web/image/delete", json_encode(["token" => "$this->token", "ids" => "3"]));
        Log::write("post". var_export($data,true));
        echo $data . "\n\n";
        echo print_r(json_decode($data,1)) . "\n\n";

        //Route::any('web/image/getHistoryList', 'web/upload/getAll');                                                               // 获取历史上传图片列表
        $data = Tools::curl($this->url . "web/image/getHistoryList", json_encode(["token" => "$this->token"]));
        Log::write("post". var_export($data,true));
        echo $data . "\n\n";
        echo print_r(json_decode($data,1)) . "\n\n";
    }
}
